/**
 * 
 */
package neptune.web.client.view.components.editor;

import neptune.web.client.model.topology.SerializableNode;
import neptune.web.client.model.topology.SerializableSoftware;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.TreeItem;

/**
 * Modifica semplicemente il topology tree, senza modificare il nodo appartenente al model
 * 
 * @author Roberto Bifulco [RobertoBifulco.it] [info@robertoBifulco.it]
 *
 */
public class AddSoftwareGraphicCommand implements Command {

	private SerializableNode node;
	private TreeItem item;
	private final SerializableSoftware soft;

	public AddSoftwareGraphicCommand(SerializableNode node,SerializableSoftware soft, TreeItem item) {
		this.node = node;
		this.soft = soft;
		this.item = item;
	}

	/* (non-Javadoc)
	 * @see com.google.gwt.user.client.Command#execute()
	 */
	public void execute() {
		final TreeItem softItem = new TreeItem();
		item.getChild(1).addItem(softItem);
		softItem.setWidget(new SoftwareMenuBar(soft,node,softItem));
	}

}
